﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MySoftLab.DapFlashCore.CoreSight
{
    public class APv1Address : APAddressBase
    {
        private uint _dp;

        public APv1Address(uint address, uint dp = 0) : base(address, dp)
        {
            _dp = dp;
        }

        public override APVersion APVersion => APVersion.APv1;

        public uint ApSel
        {
            get
            {
                return _nominalAddress;
            }
        }

        public override uint Address => ApSel << APSEL_SHIFT;

        public override uint IdrAddress => AP_IDR;

        public override string ToString()
        {
            return $"#{ApSel}";
        }

        public override int GetHashCode()
        {
            // TODO
            return (int)(_nominalAddress | _dp << 24);
        }
    }
}
